<template>
	<view>
		<view v-if="titledata.content[0].coltype=='text'">
		   <view style="padding: 8px 10px;font-size: 14px; display: flex;flex-direction: row;" >
			 <input :disabled="!titledata.content[0].editable" :value="titledata.content[0].colvalue" :placeholder="titledata.content[0].placeholder"  @input="inputitem($event)"></input>
		   </view>
		</view>
		<view v-if="titledata.content[0].coltype=='date'">
		   <view style="padding: 8px 0;font-size: 14px; display: flex;flex-direction: row;" >
			<picker :mode="titledata.content[0].coltype" :disabled="!titledata.content[0].editable" :value="titledata.content[0].colvalue" :start="titledata.content[0].starts" :end="titledata.content[0].ends" @change="bindDateChange($event)">
				<view class="uni-input" style="color: #666;">{{titledata.content[0].colvalue}}</view>
			</picker>
		   </view>
		</view>
	</view>
</template>


<script>
	export default {
		props:{
			titledata:{
				type:Object
			},
			index:{
				type:Number
			}
		},
		methods:{
			inputitem(event){
				var that = this
				var inputvalue = event.detail.value
				that.titledata.content[0].colvalue = inputvalue
				that.titledata.content[0].coldisplay = inputvalue
				that.titledata.content[0].ismodified = true
				that.$emit('changeListData',that.index,that.titledata)
			},
			
			bindDateChange(event){
				var that = this
				that.titledata.content[0].colvalue =  event.detail.value
				that.titledata.content[0].ismodified =  true
				that.$emit('changeListData',that.index,that.titledata)
			},
		}
	}
</script>

<style>
</style>
